package com.hngates.architecture.service.impl;

import com.hngates.architecture.domain.ArcProject;
import com.hngates.architecture.domain.dto.ProjectBuilderDto;
import com.hngates.architecture.domain.dto.ProjectStatusDto;
import com.hngates.architecture.mapper.ArcProjectMapper;
import com.hngates.architecture.service.IArcProjectService;
import com.hngates.common.core.text.Convert;
import com.hngates.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 项目（工地）Service业务层处理
 *
 * @author jwhe
 * @date 2022-07-04
 */
@Service
public class ArcProjectServiceImpl implements IArcProjectService {
    @Autowired
    private ArcProjectMapper arcProjectMapper;

    /**
     * 查询项目（工地）
     *
     * @param id 项目（工地）主键
     * @return 项目（工地）
     */
    @Override
    public ArcProject selectArcProjectById(Long id) {
        return arcProjectMapper.selectArcProjectById(id);
    }

    /**
     * 查询项目（工地）列表
     *
     * @param arcProject 项目（工地）
     * @return 项目（工地）
     */
    @Override
    public List<ArcProject> selectArcProjectList(ArcProject arcProject) {
        return arcProjectMapper.selectArcProjectList(arcProject);
    }

    /**
     * 新增项目（工地）
     *
     * @param arcProject 项目（工地）
     * @return 结果
     */
    @Override
    public int insertArcProject(ArcProject arcProject) {
        arcProject.setCreateTime(DateUtils.getNowDate());
        return arcProjectMapper.insertArcProject(arcProject);
    }

    /**
     * 修改项目（工地）
     *
     * @param arcProject 项目（工地）
     * @return 结果
     */
    @Override
    public int updateArcProject(ArcProject arcProject) {
        arcProject.setUpdateTime(DateUtils.getNowDate());
        return arcProjectMapper.updateArcProject(arcProject);
    }

    /**
     * 批量删除项目（工地）
     *
     * @param ids 需要删除的项目（工地）主键
     * @return 结果
     */
    @Override
    public int deleteArcProjectByIds(String ids) {
        return arcProjectMapper.deleteArcProjectByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除项目（工地）信息
     *
     * @param id 项目（工地）主键
     * @return 结果
     */
    @Override
    public int deleteArcProjectById(Long id) {
        return arcProjectMapper.deleteArcProjectById(id);
    }

    @Override
    public ArcProject selectArcProjectByName(String projectName) {
        return arcProjectMapper.selectArcProjectByName(projectName);
    }

    @Override
    public List<ProjectBuilderDto> selectProjectBuilderInfos(String queryName) {
        return arcProjectMapper.selectProjectBuilderInfos(queryName);
    }

    @Override
    public Integer selectProjectCount() {
        return arcProjectMapper.selectProjectCount();
    }

    @Override
    public List<ProjectStatusDto> selectProjectStatus() {
        return arcProjectMapper.selectProjectStatus();
    }
}
